<template>
  <div v-if="shop != null && Object.keys(shop).length !== 0" class="shop-info">
    <div class="shop-top">
      <img :src="shop.logo" alt="">
      <span class="title">{{shop.name}}</span>
    </div>
    <div class="shop-middle">
      <div class="shop-middle-item shop-middle-left">
        <div class="info-sells">
          <div class="sells-count">
            {{sellCount}}
          </div>
          <div class="sells-text">总销量</div>
        </div>
        <div class="info-goods">
          <div class="goods-count">
            {{shop.goodsCount}}
          </div>
          <div class="goods-text">全部宝贝</div>
        </div>
      </div>
      <div class="shop-middle-item shop-middle-right">
        <table>
          <tr v-for="(item, index) in shop.score" :key="index">
            <td>{{item.name}}</td>
            <td class="score" :class="{'score-better':item.isBetter}">{{item.score}}</td>
            <td class="better" :class="{'better-more':item.isBetter}">{{item.isBetter ? '高':'低'}}</td>
          </tr>
        </table>
      </div>
    </div>
    <div class="shop-bottom">
      <div class="enter-shop">进店逛逛</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'IshopDetailshopinfo',
  props:{
    shop:{
      type:Object,
      default:{}
    }
  },
  data() {
    return {
      
    };
  },

  mounted() {
    
  },
  computed:{
    sellCount: function () {
      if(this.shop){
        let value = this.shop.sells
        if (value < 10000) return value;
        return (value/10000).toFixed(1) + '万'
      }
    }
  },
  methods: {
    
  },
};
</script>

<style scoped>
.shop-info{
  padding: 10px;
  border-bottom: 5px solid #f2f5f8;
}
.shop-top{
  display: flex;
  align-items: center;
  margin-top: 10px;
}
.shop-top img{
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid #000;
}
.shop-top .title{
  font-size: 20px;
  margin-left: 10px;
}

.shop-middle{
  display: flex;
  align-items: center;
  margin-top: 30px;
}
.shop-middle-item{
  flex: 1;
}
.shop-middle-left{
  display: flex;
  border-right: 1px solid rgba(0,0,0,.1);
}

.info-sells{
  flex: 1;
  text-align: center;
}
.info-goods{
  flex: 1;
  text-align: center;
}

.sells-count, .goods-count {
    font-size: 18px;
  }

  .sells-text, .goods-text {
    margin-top: 10px;
    font-size: 12px;
  }

.shop-middle-right{
  font-size: 13px;
}

.shop-middle-right table {
  margin: auto;
}

.shop-middle-right table td {
  padding: 5px 5px;
}

.shop-middle-right .score {
  color: #5ea732;
}

.shop-middle-right .score-better {
    color: #f13e3a;
  }

  .shop-middle-right .better {
    background-color: #5ea732;
    color: #fff;
    text-align: center;
  }

  .shop-middle-right .better-more {
    background-color: #f13e3a;
  }


.shop-bottom{
  margin-top: 20px;
  margin-bottom: 20px;
  text-align: center;
}
.enter-shop{
  background-color: #f2f5f8;
  border-radius: 10px;
  display: inline-block;
  width: 150px;
  height: 30px;
  line-height: 30px;
}
</style>